Repository navigation
fleet-secrets: bound every fallback subprocess wait (#14040 Residual B) - #14362
Merged
Merged
Conversation
The secrets client's fallback tiers spawned `bws` / `op` children through Command::output(), which waits forever -- a wedged child was the one remaining path by which a client could still hang under the never-hang ruling. The broker legs already bound each exchange (BROKER_ATTEMPT_TIMEOUT, PR #14021); the subprocess waits did not. - run_command_bounded: a bounded Command::output() -- spawn, drain stdout/stderr on threads, poll try_wait, kill at the deadline. Same spawn/poll/kill shape as the secrets broker's own BwsRunner in fleet-queue. - SUBPROCESS_ATTEMPT_TIMEOUT (10s, mirroring BROKER_ATTEMPT_TIMEOUT) is the per-invocation ceiling carried by ProcessRunner (the `op` tier) and BwsTokenRunner (the `bws` tier); both runners take a caller-chosen ceiling for tests. - The `bws --version` probe in program resolution is bounded too (PROGRAM_PROBE_TIMEOUT, 5s): a wedged candidate now fails the runnable gate instead of hanging resolution. - Tests drive a real never-exiting child (sh -c "sleep 60") through the helper, both runners, and the probe, asserting the timeout error lands well inside the bound; a quick-child test pins output/status behaviour. Out of scope per the packet: BROKER_RETRY_BUDGET / BROKER_ATTEMPT_TIMEOUT unchanged (Residual A stays decided separately on #14040). The broker server's own refresh runner (fleet-queue BwsRunner) already bounds its child at 60s and is not part of the client fallback chain. Refs #14040, #13948. Queue task 23285.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #14040 (Residual B only — the issue stays open for Residual A), #13948. Queue task 23285.
What
Every subprocess wait in the secrets client's fallback chain is now bounded. The
bwsandoptiers spawned children throughCommand::output(), which waits forever — a wedged child was the one remaining path by which a secrets client could still hang under the never-hang ruling (#14040 Residual B). The broker legs got their per-attempt bound in PR #14021; the subprocess waits never did.run_command_bounded— a boundedCommand::output(): spawn, drain stdout/stderr on threads (a chatty child cannot deadlock the wait on a full pipe), polltry_wait, kill at the deadline. Same spawn/poll/kill shape as the secrets broker's ownBwsRunnerin fleet-queue.SUBPROCESS_ATTEMPT_TIMEOUT= 10s — one named per-invocation ceiling mirroringBROKER_ATTEMPT_TIMEOUT, carried byProcessRunner(theoptier) andBwsTokenRunner(thebwstier). Both runners accept a caller-chosen ceiling so tests can prove the bound without waiting out the production one.bws --versionprobe is bounded too (PROGRAM_PROBE_TIMEOUT= 5s, viaprogram_runs_within): a wedged candidate now fails the runnable gate inresolve_bws_programinstead of hanging program resolution.Tests
cargo test -p fleet-secrets— 42 passed, 0 failed, including 5 new tests that drive a real never-exiting child (sh -c "sleep 60") through the helper, both runners, and the probe, asserting thetimed outerror lands well inside the bound; a quick-child test pins output/status behaviour.cargo check -p fleet-queueandcargo check -p fleetpass (theCommandRunnertrait itself is unchanged, so the broker'sBwsRunnerimpl is untouched).Test route note: a fleet Actions exec session was attempted first — the detached dispatch returned HTTP 422 and an earlier attached start timed out at the channel — so the suite ran with cargo in the laptop worktree (not a nix-store build), the same fallback ITEM-WORK-134 used. Repo CI runs on main only, so it verifies this change on the merge push.
cargo clippycould not run on the laptop: its rustc (1.99.1) rejects the prebuilt registry artifacts of unrelated dependency crates with E0514 — a host toolchain mismatch, pre-existing and untouched by this diff.Out of scope (per the packet)
BROKER_RETRY_BUDGET/BROKER_ATTEMPT_TIMEOUTunchanged — Residual A (the 120s unanswered-leg budget) stays decided separately on secrets client never-hang residuals: 120s unanswered-leg budget (decision) + unbounded fallback subprocess waits #14040, which is why this PR does not close it.BwsRunner) already bounds its child at 60s and is not part of the client fallback chain.{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-24T13:29:07Z", "session_id": null, "lane": null, "host": "amd", "worktree": "/home/user/wt-lane-23285-neverhang", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/user/wt-lane-23285-neverhang", "repo": "developing-today/code", "branch": "queue/23285-neverhang-b", "sha": "2c0f7e04269140006c7f19a4eecbd18adb434781" }, "auth_subject": "oc-code-08", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.